import request from 'src/utils/request'
import setting from "../settings";

//获取产品相关属性选项列表
export function appProductOptions(data) {
  return request({
    url: '/app-products/get-options',
    method: 'post',
    data
  })
}

//产品列表
export function appProductList(data) {
  return request({
    url: '/app-products/list',
    method: 'post',
    data
  })
}

//产品删除

export function appProductDelete(data) {
  return request({
    url: '/app-products/delete',
    method: 'post',
    data
  })
}

//产品详情

export function appProductDetails(data) {
  return request({
    url: `/app-products/get?id=${data.id}`,
    method: 'post',
    data
  })
}

// 获取标签选项列表
export function getTagOptionsList(data) {
  return request({
    url: `/tags/options`,
    method: 'post',
    data
  })
}

//保存标签

export function saveTag(data) {
  return request({
    url: '/tags/save',
    method: 'post',
    data
  })
}

//删除标签
export function deleteTag(data) {
  return request({
    url: '/tags/delete',
    method: 'post',
    data
  })
}

// 标签列表

export function tagsList(data) {
  return request({
    url: '/tags/index',
    method: 'post',
    data
  });
}

//编辑
export function appProdctUpdate(data) {
  return request({
    url: `/app-products/update?id=${data.id}`,
    method: 'post',
    data
  })
}

//添加
export function addAppProduct(data) {
  return request({
    url: '/app-products/create',
    method: 'post',
    data
  })
}

//上架产品列表
export function appRackinglist(data) {
  return request({
    url: `/app-products/putaway-list`,
    method: 'post',
    data
  })
}

//下架操作
export function soldOut(data) {
  return request({
    url: `/app-products/sold-out`,
    method: 'post',
    data
  })
}

//下架列表

export function appProductSoldList(data) {
  return request({
    url: '/app-products/sold-out-list',
    method: 'post',
    data
  });
}

//上架操作
export function appProductRaking(data) {
  return request({
    url: '/app-products/putaway',
    method: 'post',
    data
  })
}

// 回收站列表
export function appProductDelList(data) {
  return request({
    url: '/app-products/delete-list',
    method: 'post',
    data
  })
}

//恢复操作

export function recoverAppProduct(data) {
  return request({
    url: '/app-products/recover',
    method: 'post',
    data
  })
}

//产品投诉列表

export function appComplaintList(data) {
  return request({
    url:'/app-complaint/list',
    method:'post',
    data
  })
}

export function appComplaintSave(data) {
  return request({
    url:'/app-complaint/save',
    method:'post',
    data
  })
}

//根据产品名称获取产品列表
export function getProductList(data) {
  return request({
    url:'/app-products/get-app-list-by-name',
    method:'post',
    data
  })
}

//获取预注册参数

export function getPreRegParams(data) {
  return request({
    url:'/app-products/get-pre-reg-params',
    method:'post',
    data
  })
}

//预注册测试页面
export function doPreRegTest(data) {
  return request({
    url:'/app-products/do-pre-reg-test',
    method:'post',
    data
  })
}



export const uplaodUrl = process.env.VUE_APP_UPLOAD_IMG_URL + setting.apiVersion + '/app-products/upload-icon-image';

